package com.hzit.service.impl;

import com.hzit.entity.Student;
import com.hzit.mapper.StudentMapper;
import com.hzit.service.StudentService;
import com.hzit.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;

import java.io.IOException;
import java.util.List;

/**
 * 类名：
 * 作者：WF
 * 功能：
 */
public class StudentServiceImpl implements StudentService {


	@Override
	public List<Student> findAll() throws IOException {
		SqlSessionFactory sqlSessoinFactory = MybatisUtil.getSqlSessoinFactory();
		try(SqlSession session = sqlSessoinFactory.openSession()) {
			StudentMapper mapper = session.getMapper(StudentMapper.class);
			return mapper.findAll();
		}
	}
}
